<?php

namespace Common\Model;

use Think\Hook;
use Think\Model;
class UserViewModel extends Model\ViewModel {
    public $viewFields = array(
        'User'=>array('*', '_type'=>'LEFT'),
        'UserGroupAccess'=>array('group_id', '_type'=>'LEFT', '_on'=>'User.id = UserGroupAccess.uid'),
        'UserGroup'=>array(
            'title'=>'group_name','code'=>'group_code','rules'=>'group_rules', 'status'=>'group_status','pid'=>'group_pid','_type'=>'LEFT','_on'=>'UserGroup.id = UserGroupAccess.group_id',
        ),
    );
    protected function _initialize()
    {
        parent::_initialize();
        Hook::listen('USER_VIEW_FIELDS', $this->viewFields); // 扩展
    }
}